﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace xuyiying
{
    public partial class Form1 : Form
    {
        public static bool login;
        public Form1()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            SqlOperate obj = new SqlOperate();
            string sql = "select PassCode from T_login where UserName='" + textBox1.Text + "'";
            SqlDataReader dr = obj.GetDR(sql);
            string s = "";
            while (dr.Read())
            {
                s = dr.GetValue(0).ToString();
            }
            if (textBox2.Text == s)
            {
                login = true;
                this.Close();
            }
            else
            {
                MessageBox.Show("用户名、密码错误！");
                textBox1.Text = "";
                textBox2.Text = "";
                textBox1.Focus();
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
    }
}
